package com.weds.data_sync.pojo.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.weds.data_sync.config.typehandler.ListTypeHandler;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 执行方案
 * </p>
 *
 * @author lhw
 * @since 2023-12-29
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "public.data_sync_script_plan", autoResultMap = true)
@Schema(name = "DataSyncScriptPlanDO", description = "执行方案")
public class DataSyncScriptPlanDO {

    @Schema(description = "方案id")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @Schema(description = "方案编号")
    @TableField("plan_no")
    private String planNo;

    @Schema(description = "方案名称")
    @TableField("plan_name")
    private String planName;

    @Schema(description = "脚本数组")
    @TableField(value = "script_arr", typeHandler = ListTypeHandler.class)
    private List<Integer> scriptArr;

    @Schema(description = "执行方式: 1轮询 2……")
    @TableField("run_type")
    private Integer runType;

    @Schema(description = "定时任务cron")
    @TableField("run_cron")
    private String runCron;

    @Schema(description = "创建时是否立即执行")
    @TableField("is_once")
    private Integer isOnce;

    @Schema(description = "是否开启回调")
    @TableField("is_callback")
    private Integer isCallback;

    @Schema(description = "回调方式: 1 rest 2 MQ")
    @TableField("callback_type")
    private String callbackType;

    @Schema(description = "回调路径")
    @TableField("callback_url")
    private String callbackUrl;

    @Schema(description = "路由方式: 1 topic 2 fanout 3 direct")
    @TableField("callback_route_type")
    private Integer callbackRouteType;

    @Schema(description = "回调路由交换机")
    @TableField("callback_route_exchange")
    private String callbackRouteExchange;

    @Schema(description = "回调路由key")
    @TableField("callback_route_key")
    private String callbackRouteKey;

    @TableField("executor_id")
    @Schema(description = "执行器id")
    private String executorId;

    @TableField("job_task_id")
    @Schema(description = "调度的任务id")
    private String jobTaskId;

    @Schema(description = "启用状态")
    @TableField("use_status_id")
    private Integer useStatusId;

    @Schema(description = "删除状态")
    @TableField("is_delete")
    private Integer isDelete;

    @Schema(description = "备注")
    @TableField("remark")
    private String remark;

    @Schema(description = "创建时间")
    @TableField("ct_date")
    private LocalDateTime ctDate;

    @Schema(description = "修改时间")
    @TableField("lt_date")
    private LocalDateTime ltDate;

    @Schema(description = "创建用户id")
    @TableField("ct_user_id")
    private Integer ctUserId;

    @Schema(description = "修改用户id")
    @TableField("lt_user_id")
    private Integer ltUserId;
}
